<?php

require_once "core/db.php";

/**
 *  Выборка некоторого значения из базы
 * @author PeoneEr
 */
class valueSelect {

    /**
     * @var $_query 
     * @var $_fetch
     */
    public static    $_query = NULL;
    public static $_fetch = array();

    public static function selectValue($id) {
        /**
         * @param int $id
         * @var string $selectQuery
         * @return int $value
         */
        DB::getInstance()->openConnectionToGS();
        self::$_query = "SELECT `value_setting` FROM `personal_settings` WHERE `id` = '$id' ";
        try {
            self::$_fetch = mysql_fetch_assoc(DB::getInstance()->sql(self::$_query));
        } catch (Exception $e) {
            echo $e->getMessage();
        }
        if (empty(self::$_fetch['value_setting']) or !isset(self::$_fetch['value_setting']) or is_null(self::$_fetch['value_setting'])) {
            return false;
            DB::getInstance()->closeConnection();
            unset(self::$_query, self::$_fetch);
        } else {
            return self::$_fetch['value_setting'];
            DB::getInstance()->closeConnection();
            unset(self::$_query, self::$_fetch);
        }
    }

}

?>
